﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using Microsoft.AspNetCore.DataProtection;

namespace Stock.Core.Common
{
    public class DataEncrypt
    {
		IDataProtector _protector;

        public DataEncrypt()
        {

        }


        public string EncryptMD5(string value)
        {
            return Shared.Infrastructure.Utilities.EncryptHelper.EncryptMD5(value);
        }

		#region DataProtection

		/// <summary>
		/// DataProtection.加密只能这台机子来解密，如果要在分布式中使用，要配置共享密钥文件
		/// </summary>
		/// <returns>The protect.</returns>
		/// <param name="value">Value.</param>
		public string Protect(string value)
		{
			return _protector.Protect(value);
		}

		public string UnProtect(string value)
		{
			return _protector.Unprotect(value);
		}
		#endregion
    }
}
